package com.share.tool.devops.linstener;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class KafkaLinstener {

    @KafkaListener(topics = {"#{'${spring.kafka.topicName}'.split(',')}"})
    public void riskCreditApply(ConsumerRecord<String, String> record, Acknowledgment ack) {
        //1.业务处理
        log.info("正在消费topic={},partition={},offset={}", record.topic(), record.partition(), record.offset());

        //2.提交偏移量
        ack.acknowledge();
    }
}
